/*
 * CProcManager.java
 * 
 * Copyright (c) 2009 Giles Millward (Manigra). All rights reserved.
 * 
 * This file is part of JRogueDPS.
 * 
 * JRogueDPS is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * JRogueDPS is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with JRogueDPS.  If not, see <http://www.gnu.org/licenses/>.
 */

package dpssystem;

import dpsstats.CProcStats;
import dpssystem.CProc.AttackType;
import geardatabase.CProcItem;
import java.util.ArrayList;

/**
 *
 * @author Giles Millward (Manigra)
 */
public class CProcManager {
    ArrayList<CProc> m_procArray = new ArrayList<CProc>();

    CProcManager(CSim p_sim)
    {
        for (int i = 0; i < p_sim.m_dpsInterface.m_trinketProcs.m_procItems.size(); i++)
        {
            CProcItem l_procItem = p_sim.m_dpsInterface.m_trinketProcs.m_procItems.get(i);
            CProcStats l_procStats = new CProcStats(l_procItem.m_name);
            CProcGeneric l_procGeneric = new CProcGeneric(l_procItem, l_procStats);
            m_procArray.add(l_procGeneric);
            p_sim.m_stats.m_procStats.add(l_procStats);
        }
    }

    public void executeProc(CSim p_sim, AttackType p_attackType, boolean p_crit, CWeapon p_weapon)
    {
        // Loop through trinkets
        for (int i = 0; i < m_procArray.size(); i++)
        {
            m_procArray.get(i).executeProc(p_sim, p_attackType, p_crit, p_weapon);
        }
    }

    public void queueUpOnUseProcs(CSim p_sim)
    {
        // Loop through trinkets
        for (int i = 0; i < m_procArray.size(); i++)
        {
            ((CProcGeneric) m_procArray.get(i)).initOnUseProc(p_sim);
        }
    }
}
